<script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/ueditor/ueditor.all.js"></script>
<!-- 编辑器公式插件 -->
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/addKityFormulaDialog.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/getKfContent.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/kityformula-plugin/defaultFilterFix.js"></script>
<div class="span10" id="datacontent">

    <ul class="breadcrumb">
        <li><a href="/exercise/index/index">剑雅真题</a> <span class="divider">/</span></li>
        <li><a href="/exercise/read/index">阅读练习</a> <span class="divider">/</span></li>
        <li class="active">添加题目</li>
    </ul>
    <form action="/exercise/read/add" method="post" class="form-horizontal">
        <fieldset>
            <div class="control-group">
                <label for="area" class="control-label">主分类：</label>
                <div class="controls">
                    <select name="cate_id" id="">
                        <?php foreach ($option['cate'] as $k => $v): ?>
                            <option value="<?php echo $v['cate_id']?>" <?php echo $cate_id==$v['cate_id']?'selected':''?>><?php echo $v['name']?></option>

                        <?php endforeach ?>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">名称：</label>
                <div class="controls">
                    <input type="text" name="name" value="">
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">标题：</label>
                <div class="controls">
                    <input type="text" value="" name="title">
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">标题图片：</label>
                <div class="controls">
                    <input type="text" value="" class="title_image" name="title_image">
                    <a href="#" class="btn btn-info" onclick="upImage2()">上传文件</a>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">题目图片：</label>
                <div class="controls">
                    <input type="text" value="" class="image" name="image">
                    <a href="#" class="btn btn-info" onclick="upImage3()">上传文件</a>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">浏览量：</label>
                <div class="controls">
                    <input type="text" value="" name="viewCount">
                </div>
            </div>
            
            <div class="control-group">
                <label for="area" class="control-label">描述：</label>
                <div class="controls">
                    <textarea name="description" style="width: 90%;height: 500px;"></textarea>
                </div>
            </div>

            <div class="control-group">
                <label for="area" class="control-label">题干：</label>
                <div class="controls">
                    <textarea id="sss" name="cnName" style="height: 300px;"></textarea>
                </div>
            </div>
            
            <div class="control-group">
                <label for="area" class="control-label">标题/答案：</label>
                <div class="controls">
                    <input type="text" value="" name="answer">
                </div>
            </div>

            <div class="control-group">
                <label for="area" class="control-label">类型/解析：</label>
                <div class="controls">
                    <input type="text" value="" name="numbering">
                </div>
            </div>

            <div class="control-group">
                <label for="area" class="control-label">选项：</label>
                <div class="controls">
                    <textarea name="sentenceNumber" style="width: 90%;height: 200px;"></textarea>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">题目：</label>
                <div class="controls">
                    <textarea id="article" name="article" style="height: 300px;"></textarea>
                </div>
            </div>


            <div class="control-group">
                <label for="area" class="control-label">题型：</label>
                <div class="controls">
                    <select name="type" id="">
                    <?php foreach ($option['type'] as $k => $v): ?>
                            <option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
                            
                        <?php endforeach ?>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">难度：</label>
                <div class="controls">
                    <select name="level" id="">
                    <?php foreach ($option['level'] as $k => $v): ?>
                            <option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
                            
                        <?php endforeach ?>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">话题：</label>
                <div class="controls">
                    <select name="topic" id="">
                    <?php foreach ($option['topic'] as $k => $v): ?>
                            <option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
                            
                        <?php endforeach ?>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label for="area" class="control-label">考点：</label>
                <div class="controls">
                    <input type="text" value="" name="test_site">
                </div>
            </div>
            <div class="control-group">
                <div class="controls">
                    <button class="btn btn-primary" type="submit">提交</button>
                </div>
            </div>
        </fieldset>
    </form>
</div>
<script>
    //实例化编辑器
    //题干
    var o_ueditorupload = UE.getEditor('sss',
        {
            autoHeightEnabled:false
        });

    o_ueditorupload.ready(function ()
    {

        // o_ueditorupload.hide();//隐藏编辑器

        //监听图片上传
        o_ueditorupload.addListener('beforeInsertImage', function (t,arg)
        {
            $('.image').val(arg[0].src);

        });

        /* 文件上传监听
         * 需要在ueditor.all.min.js文件中找到
         * d.execCommand("insertHtml",l)
         * 之后插入d.fireEvent('afterUpfile',b)
         */
        o_ueditorupload.addListener('afterUpfile', function (t, arg)
        {

        });
    });
    //题目
    var o_ueditorupload = UE.getEditor('article',
        {
            autoHeightEnabled:false
        });

    o_ueditorupload.ready(function ()
    {

        // o_ueditorupload.hide();//隐藏编辑器

        //监听图片上传
        o_ueditorupload.addListener('beforeInsertImage', function (t,arg)
        {
            $('.image').val(arg[0].src);

        });

        /* 文件上传监听
         * 需要在ueditor.all.min.js文件中找到
         * d.execCommand("insertHtml",l)
         * 之后插入d.fireEvent('afterUpfile',b)
         */
        o_ueditorupload.addListener('afterUpfile', function (t, arg)
        {

        });
    });

    // 标题图片
    var o_ueditorupload2 = UE.getEditor('j_ueditorupload2',
        {
            autoHeightEnabled:false
        });

    o_ueditorupload2.ready(function ()
    {

        o_ueditorupload2.hide();//隐藏编辑器

        //监听图片上传
        o_ueditorupload2.addListener('beforeInsertImage', function (t,arg)
        {
            $('.title_image').val(arg[0].src);

        });

        /* 文件上传监听
         * 需要在ueditor.all.min.js文件中找到
         * d.execCommand("insertHtml",l)
         * 之后插入d.fireEvent('afterUpfile',b)
         */
        o_ueditorupload2.addListener('afterUpfile', function (t, arg)
        {

        });
    });
    //弹出图片上传的对话框
    function upImage2()
    {
        var myImage2 = o_ueditorupload2.getDialog("insertimage");
        myImage2.open();
    }


    // 题目图片
    var o_ueditorupload3 = UE.getEditor('j_ueditorupload3',
        {
            autoHeightEnabled:false
        });

    o_ueditorupload3.ready(function ()
    {

        o_ueditorupload3.hide();//隐藏编辑器

        //监听图片上传
        o_ueditorupload3.addListener('beforeInsertImage', function (t,arg)
        {
            $('.image').val(arg[0].src);

        });

        /* 文件上传监听
         * 需要在ueditor.all.min.js文件中找到
         * d.execCommand("insertHtml",l)
         * 之后插入d.fireEvent('afterUpfile',b)
         */
        o_ueditorupload3.addListener('afterUpfile', function (t, arg)
        {

        });
    });
    //弹出图片上传的对话框
    function upImage3()
    {
        var myImage3 = o_ueditorupload3.getDialog("insertimage");
        myImage3.open();
    }
</script>
<script type="text/plain" id="sss"></script>
<script type="text/plain" id="j_ueditorupload2"></script>
<script type="text/plain" id="j_ueditorupload3"></script>